package itdep.domain.education;

import itdep.domain.IisEntity;
import itdep.domain.division.Speciality;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 10 $ $Date: 2010-06-16 07:13:04 +0000 (Wed, 16 Jun 2010) $
 */
@Entity
@Table(name = "EDUCATION_SEMESTER")
public class EducationSemester extends IisEntity {

	@ManyToOne
	@JoinColumn(name = "ID_SPECIALITY", nullable = false)
	private Speciality speciality;

	@ManyToOne
	@JoinColumn(name = "ID_EDUCATION_YEAR", nullable = false)
	private EducationYear educationYear;

	@Column(name = "SEMESTER", nullable = false)
	private int semester;

	@Column(name = "SESSION_START_DATE", nullable = true)
	private Date sessionStartDate;

	@Column(name = "SESSION_END_DATE", nullable = true)
	private Date sessionEndDate;

	@OneToMany
	@JoinColumn(name = "ID_EDUCATION_SEMESTER", nullable = false)
	private Set<EducationPlan> educationPlans = new HashSet<EducationPlan>();

	public Speciality getSpeciality() {
		return speciality;
	}

	public void setSpeciality(Speciality speciality) {
		this.speciality = speciality;
	}

	public EducationYear getEducationYear() {
		return educationYear;
	}

	public void setEducationYear(EducationYear educationYear) {
		this.educationYear = educationYear;
	}

	public int getSemester() {
		return semester;
	}

	public void setSemester(int semester) {
		this.semester = semester;
	}

	public Date getSessionStartDate() {
		return sessionStartDate;
	}

	public void setSessionStartDate(Date sessionStartDate) {
		this.sessionStartDate = sessionStartDate;
	}

	public Date getSessionEndDate() {
		return sessionEndDate;
	}

	public void setSessionEndDate(Date sessionEndDate) {
		this.sessionEndDate = sessionEndDate;
	}
}
